﻿<?php 
 include_once '../../conn/all.php';
?>
<?php 
$coordinate='111.776334, 37.696357';
	 	session_start();
	 	$user=$_SESSION["unc"];
	 	$i=0;
	 	$res=sql('s', 'face','*','where user="'.$user.'"');
	 	if ($res) {
	 		$tel=$res["tel"];
			$title=$res["title"];
	 		$qq=$res["qq"];
	 		$qq1=$res["qq1"];
	 		$qq2=$res["qq2"];
	 		$adress=$res["adress"];
	 		if($res["coordinate"]!=''){
	 			$coordinate=$res["coordinate"];
	 		}
	 		
	 	}else{
	 		$tel='';
			$title='';
	 		$qq='';
	 		$qq1='';
	 		$qq2='';
	 		$adress='';
	 		$coordinate='111.776334, 37.696357';
			
	 	}
			
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link href="../templates/met/images/css/reset.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="../templates/met/images/css/metinfo.css" />
<script type="text/javascript"src="../include/metvar.js"></script>
<script type="text/javascript" src="../include/metinfo.js"></script>
<script type="text/javascript" src="../../public/js/metinfo-min.js"></script>
<script type="text/javascript" src="../templates/met/images/js/iframes.js"></script>
<script type="text/javascript" src="../templates/met/images/js/cookie.js"></script>

<script type="text/javascript" src="http://api.map.baidu.com/api?v=1.2"></script>
<style type="text/css">
body{
	font-size: ; 
	font-family:;
	text-align:center;
}
</style>

<title>备用字段配置</title>
</head>
<body>


<div id="languge">
	<ul id="langlist">

        <li class="onlang"><a class="lang" href="?lang=cn" onclick="return duolang('cn');" title="简体中文">简体中文</a></li>


        <div class="clear"></div>
    </ul>
</div>

<script type="text/javascript">
$(document).ready(function()
	{
		$("form :input").change(function ()
		{
			$('form').data('changed',true);
		});
	}
	);
function duolang(lang){
	if($('form').data('changed')){
		if(!confirm(user_msg['js10']))return false;
		else{
			langCookie(lang); 
		}
	}else{
		langCookie(lang); 
	}
}
function langCookie(lang){
	parent.$.cookie('langget',null);
    parent.$.cookie('langget', 4);
	parent.location.href='../index.php?lang='+lang;
}

</script>

	<form method="POST" name="myform" action="../control.php?oper=sys_other" target="_self">
	<input name="action" type="hidden" value="modify" />
	<input name="id" type="hidden" value="2">
<table cellpadding="2" cellspacing="1" class="table">
			<tr> 
            <td class="text">标题<br></td>
            <td class="input upload"><input name="title"  type="text" class="text" value="<?=$title;?>" /></td></tr>
				
			<tr> 
			<tr> 
            <td class="text">电话<br></td>
            <td class="input upload"><input name="tel"  type="text" class="text" value="<?=$tel;?>" /></td></tr>
				
			<tr> 
			<tr> 
            <td class="text">qq1<br></td>
           <td class="input upload"> <input name="qq"   type="text" class="text" value="<?=$qq;?>" /></td>
          </tr>
			<tr> 
            <td class="text">qq2<br></td>
           <td class="input upload"> <input name="qq1"   type="text" class="text" value="<?=$qq1;?>" /></td>
          </tr>
          <tr> 
            <td class="text">qq3<br></td>
           <td class="input upload"> <input name="qq2"   type="text" class="text" value="<?=$qq2;?>" /></td>
          </tr>	
           <tr> 
            <td class="text">地址<br></td>
           <td class="input upload"> <input name="adress"   type="text" class="text" value="<?=$adress;?>" /></td>
          </tr>
			<tr> 
			<tr> 
            <td class="text">地址坐标<br></td>
            <td class="input upload">
            
             

			
  <input id="where" name="where" type="text" >
  <input type="button" value="地图上找" onClick="sear(document.getElementById('where').value);" />
  <br /><br />
  <div style="width:100%;height:350px;border:1px solid gray" id="container"></div>
  

<script type="text/javascript">
var map = new BMap.Map("container");//在指定的容器内创建地图实例
map.setDefaultCursor("crosshair");//设置地图默认的鼠标指针样式
map.enableScrollWheelZoom();//启用滚轮放大缩小，默认禁用。
map.centerAndZoom(new BMap.Point(<?=$coordinate;?>), 15);
map.addControl(new BMap.NavigationControl()); 
map.addEventListener("click", function(e){//地图单击事件
	map.clearOverlays(); 
	document.getElementById("lonlat").value = e.point.lng + ", " + e.point.lat;
});
map.panBy(450,170)
/*function iploac(result){//根据IP设置地图中心
    var cityName = result.name;
    map.setCenter(cityName);
}
var myCity = new BMap.LocalCity();
myCity.get(iploac);*/

	var pt = new BMap.Point(<?=$coordinate;?>);
	var myIcon = new BMap.Icon("images/markers.gif", new BMap.Size(25,21));
	var marker2 = new BMap.Marker(pt,{
		icon:myIcon
	});// 创建标注
	map.addOverlay(marker2);// 将标注添加到地图中
function sear(result){//地图搜索
	var local = new BMap.LocalSearch(map, {
  		renderOptions:{map: map}
	});
	local.search(result);
}


function G(id) {
    return document.getElementById(id);
}
var ac = new BMap.Autocomplete(    //建立一个自动完成的对象
    {"input" : "where"
    ,"location" : map
});
ac.addEventListener("onhighlight", function(e) {  //鼠标放在下拉列表上的事件
var str = "";
    var _value = e.fromitem.value;
    var value = "";
    if (e.fromitem.index > -1) {
        value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
    }    
    str = "FromItem<br />index = " + e.fromitem.index + "<br />value = " + value;
    
    value = "";
    if (e.toitem.index > -1) {
        _value = e.toitem.value;
        value = _value.province +  _value.city +  _value.district +  _value.street +  _value.business;
    }    
    str += "<br />ToItem<br />index = " + e.toitem.index + "<br />value = " + value;
    G("searchResultPanel").innerHTML = str;
});

var myValue;
ac.addEventListener("onconfirm", function(e) { 
 sear(document.getElementById('where').value)
});
</script>

			</td>
            
            
           </tr>
				
        <tr>
        <tr> 
            <td class="text"><br></td>
              <td class="input upload"> <input id="lonlat" name="lonlat" type="text" readonly="readonly" type="text" class="text" value="<?=$coordinate;?>" />通过十字鼠标的单击地图，获取位置的正确经纬值。</td>
           </tr>
				
        <tr>
		    <td class="text"></td>
	        <td class="submit">
		        <input type="submit" name="submit" value="保存" class="submit"  />
			    <input type="reset" name="Submit" value="重置" class="reset" />
			</td>
        </tr>
	</table>
	</form>
<div class="footer"> </div>
</body>
</html>
